package com.two.screen.water.balance.widget.dialog

import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.view.Gravity
import android.widget.ImageView
import android.widget.TextView
import com.two.screen.water.balance.R
import com.two.screen.water.balance.ui.App
import com.two.screen.water.balance.utils.DialogUtil


class AssociateDetailDialog(context: Context) : Dialog(context, R.style.ChooseDialog) {

    private var mLoginOutDialogListener: LoginOutDialogListener? = null

    private var mGoBackIv: ImageView? = null
    private var mCancelTv: TextView? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.dialog_associate_detail)
        this.setCanceledOnTouchOutside(false)

        val window = window
        if (window != null) {
            val attributes = window.attributes
            attributes.width = App.screenWidth
            window.attributes = attributes
            window.setGravity(Gravity.CENTER)
        }

        mGoBackIv = findViewById(R.id.dialog_close_iv)
        mCancelTv = findViewById(R.id.dialog_cancel_tv)

        mGoBackIv?.setOnClickListener { dismiss() }
        mCancelTv?.setOnClickListener { dismiss() }
    }


    fun setLoginOutDialogListener(l: LoginOutDialogListener) {
        mLoginOutDialogListener = l
    }


    interface LoginOutDialogListener {
        fun onConfirm()
        fun onCancel()
    }
    override fun show() {
        super.show()
        //隐藏状态栏
        window?.let { DialogUtil.hideNavigationBar(it) }
    }
}
